package com.zjitc.backend_shop.service.Impl;


import com.zjitc.backend_shop.mapper.GoodsAlbumMapper;
import com.zjitc.backend_shop.pojo.GoodsAlbum;
import com.zjitc.backend_shop.service.GoodsAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
@Transactional
public class GoodsAlbumServiceImpl implements GoodsAlbumService{
    @Autowired
    private GoodsAlbumMapper goodsAlbumMapper;
    @Override
    public boolean addGoodsAlbum(GoodsAlbum goodsAlbum) {
        return goodsAlbumMapper.insert(goodsAlbum)>0;
    }

    @Override
    public boolean deleteGoodsAlbum(Integer goods_id) {
        Example example=new Example(GoodsAlbum.class);
        example.createCriteria().andEqualTo("goods_id",goods_id);
        return goodsAlbumMapper.deleteByExample(example)>0;
    }

    @Override
    public List<GoodsAlbum> findGoodsAlbumByGoodsId(Integer goods_id) {
        Example example=new Example(GoodsAlbum.class);
        example.createCriteria().andEqualTo("goods_id",goods_id);
        return goodsAlbumMapper.selectByExample(example);
    }

}




